home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 4 / MacMania 4.toast / / Demo's / Igor Demo Pro / 1 PutContentsIn Igor Pro Folder / WaveMetrics Procedures / Annotations / Append Fit Results < prev    next >
Text File  |  1994-02-18  |  2KB  |  76 lines

  1. #include <Value Report>
  2.  
  3. |************
  4. | Assuming the top graph contains data that has just been fitted to a built-in function
  5. |  this macro adds or modifies a text box containing the fit parameters using the
  6. |  value(error) notation.  
  7. |  The textbox is given the name 'fitres'. 
  8. |  Note that substitutions had to be made for () and <> in the popup menu due to the fact
  9. |    that these are 'magic' characters in Apple menus.
  10. |    
  11. Macro AppendBIFitResults(fitType,method)
  12.     variable fitType=1
  13.     Prompt fitType,"Fit type:",popup,"gauss;lor;exp;dblexp;sine;line;poly"
  14.     variable method=4
  15.     Prompt method,"reporting method:",popup,"b.bbb;b.bbb±s.sss;b.bbb {s.sss};b.bbb≤ss≥"
  16.  
  17.     Silent 1
  18.     variable i,ilim
  19.     
  20.     if( (fitType<1) %| (fitType>7) )
  21.         Abort "unknown fit type"
  22.     endif
  23.     
  24.     String noteText="",tmpText
  25.     
  26.     i= 0; ilim= numpnts(W_sigma)
  27.     do
  28.         if( i==0 )
  29.             sprintf tmpText,"K%d=\t",i
  30.         else
  31.             sprintf tmpText,"\rK%d=\t",i
  32.         endif
  33.         noteText += tmpText + MakeValueReportString(W_coef[i],W_sigma[i],method-1,"",1)
  34.         i += 1
  35.     while( i < ilim)
  36.  
  37.     Textbox/C/N=fitres noteText
  38. End
  39.  
  40.  
  41. |************
  42. | Assuming the top graph contains data that has just be fitted to a user function
  43. |  this macro adds or modifies a text box containing the fit parameters using the
  44. |  value(error) notation.
  45. |  The textbox is given the name 'fitres'. 
  46. |    
  47. Macro AppendUserFitResults(fitCoefs,method)
  48.     String fitCoefs
  49.     Prompt fitCoefs,"Wave containing fit coefficients:",popup WaveList("*",";","")
  50.     variable method=4
  51.     Prompt method,"reporting method:",popup,"b.bbb;b.bbb±s.sss;b.bbb {s.sss};b.bbb≤ss≥"
  52.  
  53.     Silent 1
  54.     variable i,ilim
  55.     
  56.     if(  numpnts(W_sigma) != numpnts($fitCoefs) )    | at least a little error check
  57.         Abort "incorrect fit coefficient wave"
  58.     endif
  59.     
  60.     String noteText= "",tmpText
  61.     
  62.     i= 0; ilim= numpnts(W_sigma)
  63.     do
  64.         if( i==0 )
  65.             sprintf tmpText,"K%d=\t",i
  66.         else
  67.             sprintf tmpText,"\rK%d=\t",i
  68.         endif
  69.         noteText += tmpText + MakeValueReportString($(fitCoefs)[i],W_sigma[i],method-1,"",1)
  70.         i += 1
  71.     while( i < ilim)
  72.  
  73.     Textbox/C/N=fitres noteText
  74. End
  75.  
  76.